﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace QuanLyQuangCao
{
    public class connect1
    {
        public void laydulieu(string sql, string sqlcon, DataSet ds, string datatablename)
        {
            SqlConnection sc = new SqlConnection(sqlcon);
            sc.Open();
            SqlCommand sqlCmd = new SqlCommand(sql, sc);
            SqlDataAdapter sda = new SqlDataAdapter();
            sda.SelectCommand = sqlCmd;
            if (ds != null && ds.Tables.Contains(datatablename))
                ds.Tables[datatablename].Clear();
            sda.Fill(ds, datatablename);
            sc.Close();


        }
    }
}
